---
title: omit
description: >-
  Creates a modified copy of an object schema that does not contain the selected
  entries.
source: /methods/omit/omit.ts
contributors:
  - fabian-hiller
---

import { ApiList, Link, Property } from '~/components';
import { properties } from './properties';

# omit

Creates a modified copy of an object schema that does not contain the selected entries.

```ts
const Schema = v.omit<TSchema, TKeys>(schema, keys);
```

## Generics

- `TSchema` <Property {...properties.TSchema} />
- `TKeys` <Property {...properties.TKeys} />

## Parameters

- `schema` <Property {...properties.schema} />
- `keys` <Property {...properties.keys} />

### Explanation

`omit` creates a modified copy of the given object `schema` that does not contain the selected `keys`. It is similar to TypeScript's [`Omit`](https://www.typescriptlang.org/docs/handbook/utility-types.html#omittype-keys) utility type.

> Because `omit` changes the data type of the input and output, it is not allowed to pass a schema that has been modified by the <Link href='../pipe/'>`pipe`</Link> method, as this may cause runtime errors. Please use the <Link href='../pipe/'>`pipe`</Link> method after you have modified the schema with `omit`.

## Returns

- `Schema` <Property {...properties.Schema} />

## Examples

The following examples show how `omit` can be used.

### Omit specific keys

Schema that does not contain the selected keys of an existing schema.

```ts
const OmittedSchema = v.omit(
  v.object({
    key1: v.string(),
    key2: v.number(),
    key3: v.boolean(),
  }),
  ['key1', 'key3']
); // { key2: number }
```

## Related

The following APIs can be combined with `omit`.

### Schemas

<ApiList
  items={[
    'array',
    'exactOptional',
    'intersect',
    'lazy',
    'looseObject',
    'looseTuple',
    'map',
    'nonNullable',
    'nonNullish',
    'nonOptional',
    'nullable',
    'nullish',
    'object',
    'objectWithRest',
    'optional',
    'record',
    'set',
    'strictObject',
    'strictTuple',
    'tuple',
    'tupleWithRest',
    'undefinedable',
    'union',
  ]}
/>

### Methods

<ApiList
  items={[
    'assert',
    'config',
    'fallback',
    'forward',
    'getDefault',
    'getDefaults',
    'getFallback',
    'getFallbacks',
    'is',
    'keyof',
    'message',
    'parse',
    'parser',
    'partial',
    'pick',
    'required',
    'safeParse',
    'safeParser',
    'unwrap',
  ]}
/>

### Actions

<ApiList
  items={[
    'check',
    'brand',
    'description',
    'entries',
    'flavor',
    'maxEntries',
    'metadata',
    'minEntries',
    'notEntries',
    'partialCheck',
    'rawCheck',
    'rawTransform',
    'readonly',
    'title',
    'transform',
  ]}
/>

### Utils

<ApiList items={['isOfKind', 'isOfType']} />

### Async

<ApiList
  items={[
    'arrayAsync',
    'checkAsync',
    'exactOptionalAsync',
    'fallbackAsync',
    'getDefaultsAsync',
    'getFallbacksAsync',
    'intersectAsync',
    'lazyAsync',
    'looseObjectAsync',
    'looseTupleAsync',
    'mapAsync',
    'nonNullableAsync',
    'nonNullishAsync',
    'nonOptionalAsync',
    'nullableAsync',
    'nullishAsync',
    'objectAsync',
    'objectWithRestAsync',
    'optionalAsync',
    'parseAsync',
    'parserAsync',
    'partialAsync',
    'partialCheckAsync',
    'rawCheckAsync',
    'rawTransformAsync',
    'recordAsync',
    'requiredAsync',
    'safeParseAsync',
    'safeParserAsync',
    'setAsync',
    'strictObjectAsync',
    'strictTupleAsync',
    'transformAsync',
    'tupleAsync',
    'tupleWithRestAsync',
    'undefinedableAsync',
    'unionAsync',
  ]}
/>
